-- Field script to allow special handling of option-clicked
-- words in ANY text field, whether locked or unlocked
--
-- Guy Kuo, University of Nevada School of Medicine
-- December 13, 1987
--
-- Use this script freely in your owns stacks but please retain the
-- credit line
--
On MouseWithin -- UNSOM technique by Guy Kuo, December 13, 1987
-- If the the option key is depressed, set the cursor to indicate
-- we are in a special mode. While the option key continues to be
-- depressed, and the mouse is within the target field, wait for
-- mouseDowns. If one occurs, Pick up the word by clicking at the
-- last MouseLoc twice and getting the selection.
-- If the selection is not empty, do something with it. In this demo,
-- we put it into another field. Finally, click outside of the field
-- to avoid looping. Hopefully, (-1,-1) is outside of all active
-- objects.
--
-- While editing such a field, entry of Optioned characters from
-- the keyboard no longer requires movement of the mouse outside of
-- the field. However, the optioned characters do not appear until
-- after the option key is released
if the OptionKey is down then
if the locktext of the target is true then
put true into DidUnlock
set locktext of target to false
else
put false into DidUnlock
end if
set the cursor to 2
repeat while (the OptionKey is down) and (item 1 of the rect of target <= item 1 of the mouseLoc) and (item 1 of the mouseLoc <= item 3 of the rect of target) and (item 2 of the rect of target <= item 2 of the mouseLoc) and (item 2 of the mouseLoc <= item 4 of the rect of target)
if the Mouse is down then
click at the MouseLoc
click at the ClickLoc
if the selection <> empty then
put the selection into card field "result"
-- or do something useful with it
end if
click at -1,-1
end if
end repeat
if DidUnlock then
set the locktext of the target to true
end if
end if
end MouseWithin
-- part contents for background part 4
----- text -----
1
-- part contents for background part 2
----- text -----
Scrolling Text Button 1
-- part contents for card part 6
----- text -----
mouseLoc
-- part contents for card part 7
----- text -----
OPTION CLICK on any word in this field for an example of how this script works.
--
-- Field script to allow special handling of option-clicked
-- words in ANY text field, whether locked or unlocked
--
-- Guy Kuo, University of Nevada School of Medicine
-- December 13, 1987
--
-- Use this script freely in your owns stacks but please retain the
-- credit line
--
On MouseWithin -- UNSOM technique by Guy Kuo, December 13, 1987
-- If the the option key is depressed, set the cursor to indicate
-- we are in a special mode. While the option key continues to be
-- depressed, and the mouse is within the target field, wait for
-- mouseDowns. If one occurs, Pick up the word by clicking at the
-- last MouseLoc twice and getting the selection.
-- If the selection is not empty, do something with it. In this demo,
-- we put it into another field. Finally, click outside of the field
-- to avoid looping. Hopefully, (-1,-1) is outside of all active
-- objects.
--
-- While editing such a field, entry of Optioned characters from
-- the keyboard no longer requires movement of the mouse outside of
-- the field. However, the optioned characters do not appear until
-- after the option key is released
if the OptionKey is down then
if the locktext of the target is true then
put true into DidUnlock
set locktext of target to false
else
put false into DidUnlock
end if
set the cursor to 2
repeat while (the OptionKey is down) and¬
(item 1 of the rect of target <= item 1 of the mouseLoc) and¬
(item 1 of the mouseLoc <= item 3 of the rect of target) and¬
(item 2 of the rect of target <= item 2 of the mouseLoc) and¬
(item 2 of the mouseLoc <= item 4 of the rect of target)
if the Mouse is down then
click at the MouseLoc
click at the ClickLoc
if the selection <> empty then
--
--the selected word is now in 'selection'. It's up to you to do something with it.